using System;
using System.ComponentModel.DataAnnotations;
using ThuySan.Bussiness;

namespace ThuySan.Models
{
	[Serializable]
	public partial class EmailTemplateModel 
	{

		#region Constructor

		public EmailTemplateModel()
		{
		}

		public EmailTemplateModel(EmailTemplate value)
		{
			Id = value.Id;
			Name = value.Name;
			Subject = value.Subject;
			Body = value.Body;
		}

		#endregion

		#region Fields

		private System.Int32 _Id;

		private System.String _Name;

		private System.String _Subject;

		private System.String _Body;

		#endregion

		#region Properties

		//[NotChanged]
		//[Required(ErrorMessage = "Value is required")]
		//[Range(0, 0, ErrorMessage = "Value must be between 0 and 0")]
		//[StringLength(0)]
		//[RegularExpression(@"\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*", ErrorMessage = "Email address is not valid")]
		public System.Int32 Id
		{
			get
			{
				return _Id;
			}
			set
			{
				_Id = value;
			}
		}

		//[NotChanged]
		//[Required(ErrorMessage = "Value is required")]
		//[Range(0, 0, ErrorMessage = "Value must be between 0 and 0")]
		[StringLength(200, ErrorMessage= "Value must be under 200 characters")]
		//[RegularExpression(@"\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*", ErrorMessage = "Email address is not valid")]
		public System.String Name
		{
			get
			{
				return _Name;
			}
			set
			{
				_Name = value;
			}
		}

		//[NotChanged]
		//[Required(ErrorMessage = "Value is required")]
		//[Range(0, 0, ErrorMessage = "Value must be between 0 and 0")]
		[StringLength(200, ErrorMessage= "Value must be under 200 characters")]
		//[RegularExpression(@"\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*", ErrorMessage = "Email address is not valid")]
		public System.String Subject
		{
			get
			{
				return _Subject;
			}
			set
			{
				_Subject = value;
			}
		}

		//[NotChanged]
		//[Required(ErrorMessage = "Value is required")]
		//[Range(0, 0, ErrorMessage = "Value must be between 0 and 0")]
		[StringLength(1073741823, ErrorMessage= "Value must be under 1073741823 characters")]
		//[RegularExpression(@"\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*", ErrorMessage = "Email address is not valid")]
		public System.String Body
		{
			get
			{
				return _Body;
			}
			set
			{
				_Body = value;
			}
		}

		#endregion

		#region Operators

		public void Update(EmailTemplate value)
		{
            //value.Id = Id;
            //value.Name = Name;
			value.Subject = Subject;
			value.Body = Body;
		}

		public static implicit operator EmailTemplateModel(EmailTemplate obj)
		{
			return new EmailTemplateModel(obj);
		}

		public static implicit operator EmailTemplate(EmailTemplateModel obj)
		{
			EmailTemplate value = new EmailTemplate();
			obj.Update(value);
			return value;
		}

		#endregion

	}
}
